Page({
  data: {
    coverImage: '../images/闭眼.jpg' // 封面图片路径
  },

  onLoad: function() {
    const hasSave = wx.getStorageSync('gameSave');
    this.setData({ hasSave });
  },

  startNewGame: function() {
    wx.navigateTo({
      url: '/pages/game/game?isNew=true'
    });
  },

  loadGame: function() {
    if (this.data.hasSave) {
      wx.navigateTo({
        url: '/pages/game/game?isNew=false'
      });
    } else {
      wx.showToast({
        title: '无存档可读取',
        icon: 'none'
      });
    }
  }
});